public class sushu {
    public static void main(String[] args) {
        int b=0;
        for(int i=1;i<=20000;i++){
            boolean a=true;
            for(int j=2;j<=i/2;j++){
                if(i%j==0)
                    a=false;
            }
            if(a==true) {
                b++;
                if(b>5){
                    System.out.print("\n");
                    b=1;
                }
                System.out.print(i+" ");
            }
        }
    }
}
